<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<body class="laytp-container">
<div id="opt_nav">
</div>

<div class="layui-card" id="search-form">
    <div class="layui-card-body">
        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">年度</label>
                        <div class="layui-input-block">
                            <select id="year" name="year" lay-filter="year"></select>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="TableSearchButton" type="button"><i class="layui-icon layui-icon-search"></i>查询</button>
                                <button class="layui-btn layui-btn-primary" onclick="listTableReset()" id="TableSearchReset" type="reset" ><i class="layui-icon layui-icon-refresh"></i>重置</button>
<!--                                <div id="search_open" onclick="toggle_search()">-->
<!--                                    <i class="layui-icon layui-icon-down"></i>展开-->
<!--                                </div>-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md12" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="test-dropdown-toolbar-barDemo">
    <div class="tab-list-authbut">
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_show('查看','{{d.LAY_TABLE_INDEX}}')">查看</a>
    </div>
</script>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
    </div>
</script>
<script>




    var currButAuth, currTabData;
    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;


        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });


        setSouTableExport('产值汇总表');
        var mytable = table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_engin_chan_hui_list),where: {}, page: false, height: 'full-140'
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
            ,text: TabInit.text,totalRow: true
            ,parseData: function (res) {
                var year_str = '';
                var year = res.data.year;
                for (var key in year){
                    if(res.data.is_year == year[key]){
                        year_str += '<option value="'+year[key]+'" selected>'+year[key]+'</option>';
                    }else {
                        year_str += '<option value="'+year[key]+'">'+year[key]+'</option>';
                    }

                }
                $("#year").html(year_str);

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.total,
                    "data": res.data.data
                };
            }
            , cols: [[
                {type: "checkbox", fixed: 'left'}
                ,{type:'numbers',title:'序号',totalRowText: '合计',fixed:'left'}
                ,{field: 'name', title: '单位'}
                ,{field:'allnum',title:'年度承揽总数',totalRow: true,templet: function(d){
                    return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'\')">'+d.allnum+'</span>';
                }}
                ,{field:'allfee',title:'年度产值合计(元)',totalRow: true,templet: function(d){
                        return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'\')">'+parseFormatNum(d.allfee)+'</span>';
                    }}
                ,{field:'month1',title:'一月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=1\')">'+parseFormatNum(d.month1)+'</span>';}}
                ,{field:'month2',title:'二月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=2\')">'+parseFormatNum(d.month2)+'</span>';}}
                ,{field:'month3',title:'三月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=3\')">'+parseFormatNum(d.month3)+'</span>';}}
                ,{field:'month4',title:'四月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=4\')">'+parseFormatNum(d.month4)+'</span>';}}
                ,{field:'month5',title:'五月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=5\')">'+parseFormatNum(d.month5)+'</span>';}}
                ,{field:'month6',title:'六月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=6\')">'+parseFormatNum(d.month6)+'</span>';}}
                ,{field:'month7',title:'七月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=7\')">'+parseFormatNum(d.month7)+'</span>';}}
                ,{field:'month8',title:'八月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=8\')">'+parseFormatNum(d.month8)+'</span>';}}
                ,{field:'month9',title:'九月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=9\')">'+parseFormatNum(d.month9)+'</span>';}}
                ,{field:'month10',title:'十月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=10\')">'+parseFormatNum(d.month10)+'</span>';}}
                ,{field:'month11',title:'十一月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=11\')">'+parseFormatNum(d.month11)+'</span>';}}
                ,{field:'month12',title:'十二月(元)',totalRow: true,templet: function(d){return '<span class="colorlan" onclick="openNavPage(\'工程承揽信息\',\'engin/index.php?status=1&gui_unit='+d.id+'&year='+d.year+'&month=12\')">'+parseFormatNum(d.month12)+'</span>';}}
            ]]
            , done: function (res) {
                soulTable.render(this);
            }
        });
        listTableSearch(form, table);
    });



</script>
</body>
</html>
